package com.sam.im.heiqun.uis.adapters.holder;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.sam.im.heiqun.R;
import com.sam.im.heiqun.uis.adapters.GroupMemberAdpter;

/**
 * Created by Joe on 2016/12/20.
 */

public class GroupMemberHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    public final View mView;
    public final ImageView img;
    public final ImageView image_identification;
    public final TextView txt_name;

    private GroupMemberAdpter.GroupMemberListClickListener mGroupMemberListClickListener;

    public GroupMemberHolder(View view, GroupMemberAdpter.GroupMemberListClickListener groupMemberListClickListener,final GroupMemberAdpter.GroupMemberListLongClickListener mGroupMemberListLongClickListener) {
        super(view);
        mView = view;
        this.mGroupMemberListClickListener = groupMemberListClickListener;
        img = (ImageView) view.findViewById(R.id.img);
        image_identification = (ImageView) view.findViewById(R.id.image_identification);
        txt_name = (TextView) view.findViewById(R.id.txt_name);

        mView.setOnClickListener(this);
        mView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                mGroupMemberListLongClickListener.onGroupMemberListLongClick(v,getAdapterPosition());
                return false;
            }
        });
    }

    @Override
    public void onClick(View v) {
        if (mGroupMemberListClickListener != null) {
            mGroupMemberListClickListener.onGroupMemberListClick(v, getAdapterPosition());
        }
    }
}